<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>订票结果页</title>
    <style>
        li {
            list-style: none;
        }
    </style>
</head>

<body>
    <ul>
        <li>
            <h2>您的电影票{$movie_result['movie_name']}已经购买成功</h2>
        </li>
        <li>此订单包含以下内容</li>
        <li>电影名称: &nbsp;{$movie_result['movie_name']}</li>
        <li>上映时间: &nbsp;{$movie_result['release_date']|strtotime|date='d-m-Y',###}&nbsp;{$movie_result['release_time']}</li>
        <li>上映影厅: &nbsp;{$movie_result['release_room']}</li>
        <li>票位信息</li>
        {volist name="result " id="vo " empty="你还没有订有座位 "}
        <li>{$vo['row']}排{$vo['col']}列</li>
        {/volist}
        <li>请及时打印电影票.观看电影.</li>
        <li>谢谢</li>
        <li>
            <a href="{:url( 'index/index', '', '')} ">返回首页</a>
            <a id="down_txt" href="javascript:void(0);">下载电影票TXT</a>
            <a id="cancel" href="javascript:void(0) ">取消息订单</a>
        </li>
    </ul>
    <script src="__STATIC__/js/jquery-3.4.1.js "></script>
    <script>
        $(function() {
            // 下载电影票按钮绑定单击事件
            $("#down_txt").on("click", function(e) {
                //禁止冒泡事件
                e.preventDefault();
                e.stopPropagation();
                var layout_id = "{$movie_result['layout_id']}";
                var time_at = "{$movie_result['time_at']}";
                $.ajax({
                    type: "post",
                    url: "{:url('order/download','', '')} ",
                    data: {
                        layout_id: layout_id,
                        time_at: time_at
                    },
                    success: function(result) {
                        if (result.code == 1) {
                            alert(result.msg);
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            });
            // 取消定单按钮绑定单击事件
            $("#cancel").on("click", function(e) {
                //禁止冒泡事件
                e.preventDefault();
                e.stopPropagation();
                var layout_id = "{$movie_result['layout_id']}";
                var time_at = "{$movie_result['time_at']}";
                $.ajax({
                    type: "post",
                    url: "{:url('order/cancel','', '')} ",
                    data: {
                        layout_id: layout_id,
                        time_at: time_at
                    },
                    success: function(result) {
                        if (result.code == 1) {
                            alert("取消成功");
                        } else {
                            alert("取消失败");
                        }
                    }
                });
            });
        });
    </script>
</body>

</html>